<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>帮助中心</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="/web/res/css/xadmin.css">
    <script src="/web/res/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/web/res/js/xadmin.js"></script>
</head>

<body>
<div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">帮助中心</a>
            <a><cite>举报管理</cite></a>
        </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">

                    <a class="layui-btn layui-btn-small lable-text-center"
                       style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()"
                       title="刷新">
                        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>刷新表格数据</a>
                </div>

                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5" type="post" action="/after/feedback/list">
                        <div class="layui-input-inline layui-show-xs-block">
                            <input type="text" name="nick" value="${nick!''}" placeholder="用户名"
                                   autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <input type="text" name="phone" value="${phone!''}" placeholder="手机号"
                                   autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <input type="text" name="userid" value="${userid!''}" placeholder="用户id"
                                   autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <select name="leixing">
                                <option value="">举报类型(全部)</option>
                                <option value="1" <#if leixing?exists&&leixing?trim?length gt 1><#if (leixing)?number == 1?number>selected</#if></#if> >动态</option>
                                <option value="2" <#if leixing?exists&&leixing?trim?length gt 1><#if (leixing)?number == 2?number>selected</#if></#if> >房间</option>
                                <option value="3" <#if leixing?exists&&leixing?trim?length gt 1><#if (leixing)?number == 3?number>selected</#if></#if> >用户</option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <select name="state">
                                <option value="">处理结果(全部)</option>
                                <option value="1" <#if state?exists&&state?trim?length gt 1><#if (state)?number == 1?number>selected</#if></#if> >未处理</option>
                                <option value="2" <#if state?exists&&state?trim?length gt 1><#if (state)?number == 2?number>selected</#if></#if> >已处理</option>
                            </select>
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <input class="layui-input" placeholder="开始时间" autocomplete="off" value="${start!''}"
                                   name="start" id="start">
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <input class="layui-input" placeholder="截止时间" autocomplete="off" value="${end!''}"
                                   name="end" id="end">
                        </div>

                        <div class="layui-input-inline layui-show-xs-block">
                            <button class="layui-btn" lay-submit lay-filter="search">
                                <i class="layui-icon">&#xe615;</i>搜索
                            </button>
                        </div>
                    </form>
                </div>

                <div class="layui-card-body">
                    <table class="layui-table layui-form tableH" lay-size="sm" id="tab">
                        <thead>
                        <tr>
                            <!-- <th>
                                <input type="checkbox" name="" lay-skin="primary" lay-filter="checkall">
                            </th> -->
                            <th>举报人</th>
                            <th>举报人电话</th>
                            <th>举报人名称</th>
                            <th>举报类型</th>
                            <th>举报原因</th>
                            <th>动态id/房间id/用户id/家族id</th>
                            <th>被举报人</th>
                            <th>被举报人电话</th>
                            <!-- <th>被举报人名称</th> -->
                            <th>举报时间</th>
                            <th>处理状态</th>
                            <th style="width:5px;">操作
                            </th>
                        </tr>
                        </thead>
                        <tbody>
                            <#list list as inv>
                            <tr>
                                <!-- <td class="check">
                                    <input checkid type="checkbox" name="id" id="id" lay-skin="primary"
                                           value="${(inv.id?c)!''}">
                                </td> -->
                                <td>${inv.userid!''}</td>
                                <td>${inv.phone!''}</td>
                                <td>${inv.nick!''}</td>
                                <td><#if inv.leixing==1>动态
                                <#elseif inv.leixing==2>房间
                                <#elseif inv.leixing==3>用户
                                <#elseif inv.leixing==4>家族
                                </#if></td>
                                <td>${inv.message!''}</td>
                                <td>${inv.bjbid!''}</td>
                                <td>${inv.bjbnick!''}</td>
                                <!-- <td>${inv.bjbuserid!''}</td> -->
                                <td>${inv.bjbphone!''}</td>
                                <td>${inv.createtime?string("yyyy-MM-dd HH:mm:ss")!}</td>
                                <td>
                                    <#if inv.state?exists && (inv.state)?number == 1>未处理
                                    <#elseif inv.state?exists && (inv.state)?number == 2>已处理
                                    </#if>
                                </td>
                                <td class="td-manage btn-center">
                                    <button class="layui-btn layui-btn-xs layui-btn-warm"
                                            onclick="xadmin.open('查看详情','/after/feedback/detail?id=${(inv.id?c)!''}')">
                                        <i class="layui-icon layui-icon-edit"></i>查看详情
                                    </button>
                                    <#if inv.state?contains('1')>
                                    <button class="layui-btn layui-btn-xs layui-bg-blue" onclick="chuli(this,'${(inv.id)!''}')">
                                        <i class="layui-icon layui-icon-edit"></i>待处理
                                    </button>
                                    </#if>
                                    <#if inv.state?contains('2')>
                                    <button class="layui-btn layui-btn-xs layui-btn-danger">
                                        <i class="layui-icon"></i>已处理
                                    </button>
                                    </#if>
                                </td>
                            </tr>
                            </#list>
                        </tbody>
                    </table>
                </div>
                <!-- 分页条 -->
                <div id="pager" style="text-align: center;"></div>
            </div>
        </div>
    </div>
    <input type="hidden" id="remark" name="remark">
</div>
</body>

<script>
    layui.use(['laydate', 'form', 'table'], function () {
        let $ = layui.$;
        var laydate = layui.laydate;
        var form = layui.form;
        var table = layui.table;


        // 监听全选
        form.on('checkbox(checkall)', function (data) {
            if (data.elem.checked) {
                $('.check input').prop('checked', true);
            } else {
                $('.check input').prop('checked', false);
            }
            form.render('checkbox');
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });


    });

    //通过
    function chuli(obj, id) {
        $("#remark").val("");
        layer.prompt({title: '请输入处理备注', maxlength: 20}, function (slogisticCode, index) {
            layer.close(index);
            $("#remark").val(slogisticCode);

            $.ajax({
                type: "POST",
                url: "/after/feedback/chuli",
                data: {
                    "idArray": id,
                    "remark": $("#remark").val()
                },
                dataType: "json",
                success: function (data) {
                    if (data.code === 200) {
                        layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                            location.reload();
                        });
                    } else {
                        layer.msg(data.msg, {icon: 2, time: 1000}, function () {
                            location.reload();
                        });
                    }

                }
            });
        });
    }


</script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    layui.use(['laypage', 'layer', 'form'], function () {
        let $ = layui.$;
        var laypage = layui.laypage
                , form = layui.form
                , layer = layui.layer;

        laypage.render({
            elem: 'pager'
            , count: ${splitPage.totalCount}
            , limit: ${splitPage.pageSize}
            , curr: ${splitPage.pageIndex}
            , layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            , jump: function (obj, first) {
                //首次不执行
                if (!first) {
                    var myform = document.forms[0];
                    // alert("formName:"+myform.id);
                    var pageIndex = document.createElement("input");
                    pageIndex.name = "pageIndex";
                    pageIndex.type = "hidden";
                    pageIndex.value = obj.curr;
                    myform.appendChild(pageIndex);

                    var pageSize = document.createElement("input");
                    pageSize.name = "pageSize";
                    pageSize.type = "hidden";
                    pageSize.value = obj.limit;
                    myform.appendChild(pageSize);
                    // myform.submit();

                    // $("button[lay-filter]")
                    // form.on('submit(button[lay-filter])', function(data){
                    //     // layer.msg(JSON.stringify(data.field));
                    //     // return false;
                    // });
                    // var submitBtn = $("button[lay-submit]");
                    // alert(submitBtn);
                    // console.log(submitBtn)
                    // layer.msg(JSON.stringify(submitBtn));

                    // $('[lay-filter="search"]').click();
                    // $('#chaxun').click();
                    $("button[lay-submit]:eq(0)").click();
                    // $("button[lay-submit]")[0].click();
                    // alert($("#formsubmit").attr("action")+"_获取数量："+obj.limit+"_页码数："+obj.curr);
                    // console.log(obj)
                }
            }
        });
    });
</script>


</html>